<?php
exit;
session_start();
ini_set("display_errors", "On");
error_reporting(E_ALL | E_STRICT);
$openid=NULL;
if (isset($_SESSION['openid'])){
    $openid=$_SESSION['openid'];
}
if(empty($openid)){
    exit;
}
include_once("./c/config.php");
$mysqli = new mysqli($dbhost, $dbuser, $dbpwd, $dbName);
if (!$mysqli->set_charset("utf8")) {printf("Error loading character set utf8: %s\n", $mysqliTwo->error);}

if (isset($_SESSION['nianji'])){
    $nianji=$_SESSION['nianji'];
}else{
    $query=$mysqli->query("select nianji from check3 where openid='".$openid."' limit 0,1  ");
    if($query->num_rows>0){
        $uinfo=$query->fetch_assoc();
    }else{
        $query=$mysqli->query("select nianji from check4 where openid='".$openid."' limit 0,1  ");
        $uinfo=$query->fetch_assoc();
    }
    $nianji=$uinfo['nianji'];
    $_SESSION['nianji']=$nianji;
}
$theday=date("Y-m-j H:i:s");
$endDay=date("Y-m-j H:i:s",time()+60*10);
$aTiShu=100;
if (3 == $nianji){
    $aTiShu=80;
}
if (4 == $nianji){
    $aTiShu=100;
}
if (5 == $nianji){
    $aTiShu=100;
}
if (6 == $nianji){
    $aTiShu=100;
}

$startTime=strtotime($theday);
$endTime=strtotime($endDay);
$cha=$endTime - $startTime;
$m = floor(($cha%(3600*24))%3600/60);
$s = floor(($cha%(3600*24))%60);
 
$path='./tiKu/'.$nianji.'-'.rand(1,14).'.txt';
$tiData=json_decode(file_get_contents($path), true);
$tiAInfo=$tiData['a'];
$query=$mysqli->query("select id from da where openid='".$openid."' limit 0, 1");
if($query->num_rows>0){
    exit;
}
$logNum=0;
/**
$query=$mysqli->query("select num from log_time3 where openid='".$openid."'  limit 0, 1");
if($query->num_rows>0){
    $getlogNum=$query->fetch_assoc();
    $logNum=$getlogNum['num'];
} */

//shuffle($tiAInfo);
 
$tiA=array();
 
$tiku=array();
$tidan=array();
foreach ($tiAInfo as $k => $v){
        $tiA[]=array('title'=>$v['title'],'da'=>$v['da'],'db'=>$v['db'],
            'dc'=>$v['dc'],'dd'=>$v['dd'],'dan'=>$v['dan']
        );
        $tidan[]=$v['dan'];
        $tiku[]=$v['id'];
}
//$url='./';
$url='http://tu-10030004.file.myqcloud.com/jue/';
$_SESSION['lkey']=rand(1,99999);
?><!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<title></title>
<style>
html,body{font-size:16px;background:#f5f3e9;width:100%;font-size:12px;color:#fff;font-family:Microsoft YaHei, Gotham, "Helvetica Neue", Helvetica, Arial, sans-serif;}
body, div{position:relative;padding:0px;margin:0px auto;max-width:750px;}
.weui-dialog{position:fixed;z-index:5000;width:80%;max-width:300px;top:50%;left:50%;-webkit-transform:translate(-50%,-50%);transform:translate(-50%,-50%);background-color:#FFF;text-align:center;border-radius:3px;overflow:hidden}.weui-dialog__hd{padding:1.3em 1.6em .5em}.weui-dialog__title{font-weight:400;font-size:18px}.weui-dialog__bd{padding:0 1.6em .8em;min-height:40px;font-size:15px;line-height:1.3;word-wrap:break-word;word-break:break-all;color:#999}.weui-dialog__bd:first-child{padding:1.2em 20px .1em;color:#353535}.weui-dialog__ft{position:relative;line-height:48px;font-size:18px;display:-webkit-box;display:-webkit-flex;display:flex}.weui-dialog__ft:after{content:" ";position:absolute;left:0;top:0;right:0;height:1px;border-top:1px solid #D5D5D6;color:#D5D5D6;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleY(.5);transform:scaleY(.5)}.weui-dialog__btn{display:block;-webkit-box-flex:1;-webkit-flex:1;flex:1;color:#3CC51F;text-decoration:none;-webkit-tap-highlight-color:transparent;position:relative}.weui-dialog__btn:active{background-color:#EEE}.weui-dialog__btn:after{content:" ";position:absolute;left:0;top:0;width:1px;bottom:0;border-left:1px solid #D5D5D6;color:#D5D5D6;-webkit-transform-origin:0 0;transform-origin:0 0;-webkit-transform:scaleX(.5);transform:scaleX(.5)}.weui-dialog__btn:first-child:after{display:none}.weui-dialog__btn_default{color:#353535}.weui-dialog__btn_primary{color:#0BB20C}@media screen and (min-width:1024px){.weui-dialog{width:35%}}.weui-mask{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0;background:rgba(0,0,0,.6)}.weui-mask_transparent{position:fixed;z-index:1000;top:0;right:0;left:0;bottom:0}
-webkit-touch-callout:none;
-webkit-user-select:none;
html{-ms-touch-action:none;}
div,img{-webkit-tap-highlight-color:rgba(0,0,0,0);}
*{-webkit-text-size-adjust: none;}
.simg{position:absolute;display:block;}
a{text-decoration:none;}
.txt{position:absolute;text-indent:6px;font-size:12px;z-index:2;}
.txt::-webkit-input-placeholder {color:#b4b4b4;text-align:left;}
.container{position:relative;width:100%;height:auto;}
.hide{display:none;}
input{position:absolute;display:block;text-indent:10px;-webkit-appearance:none;background:none;padding:0;outline-style:none;border:none;color:#000;}
select{position:absolute;display:block;background:transparent;border:0px;text-indent:8px;font-size:12px;-webkit-appearance:none;}
@-webkit-keyframes p1yu{0%{-webkit-transform:translateX(26px) translateY(-50px);opacity:0;}  80% {-webkit-transform:translateX(0px) translateY(0px);opacity:.9;} 100% {-webkit-transform:translateX(0px) translateY(0px);opacity:1;} }
.p1yu{-webkit-animation: p1yu 4s;}
.t-bg{position:absolute;width:100%;height:100%;background-color:#f5f3e9;opacity:.9;z-index:9;top:0px;left:0px;display:none;}
.t-bg2{position:absolute;width:100%;height:100%;background-color:#000;opacity:.6;z-index:999;top:0px;left:0px;display:none;}
.t-rule, .t-zhuyi, .ti{position:absolute;width:100%;height:100%;z-index:99;top:0px;left:0px;display:none;}
.t-end, .t-wan, .t-time{position:absolute;width:100%;height:100%;z-index:9999;top:0px;left:0px;display:none;}
#iosDialog2{display:none;z-index:9999;}
.ti-time{position:absolute;width:100%;text-align:center;font-size:12px;font-weight:700;color:#000;}
.ti-title{position:absolute;width:100%;text-align:center;font-size:20px;font-weight:700;color:#000;}
.ti-wen{width:80%;margin-left:10%;color:#666666;font-size:16px;height:auto;}
.ti-wen p{padding:0px 0px 5px 0px;}
.ti-tma{width:80%;margin-left:10%;margin-top:8px;color:#232323;font-size:13px;padding:0px 0px 6px 0px;}
.ti-dan{padding:6px 0px 6px 0px;border-bottom:1px solid #afaba8;line-height:16px;}
.ti-top{width:100%;}
.ti-jb{background:transparent url('<?php echo $url; ?>/img/n/j2.png') no-repeat;background-size:cover;}
.ti-xuanze{width:100%;}
.ti-gapa, .ti-gapb{width:100%;}
.ti-sj{width:100%;}
.t-endtxt{position:absolute;width:100%;left:0;text-align:center;color:#848484;font-size:14px;font-weight:700;}
.tip-t1{position:absolute;width:100%;font-size:16px;font-weight:700;text-align:center;color:#ec7579;}
.tip-t2{position:absolute;width:100%;font-size:12px;font-weight:700;text-align:center;color:#000;}
.tip-t3{position:absolute;width:100%;font-size:12px;text-align:center;color:#000;}
.ti-logo{z-index:2;}
@media only screen and (device-width: 375px) and (device-height: 812px) and (-webkit-device-pixel-ratio: 3) {
.ti-wen{font-size:18px;}
.ti-tma{font-size:15px;}
}
.t-doend{position:absolute;background:transparent url('<?php echo $url; ?>/img/end.png?v=2') no-repeat;background-size:cover;}
</style>
</head>
<body>
<div class="container">
  <div class="ti">
      <img class="zhuyi-t1 simg" src="<?php echo $url; ?>/img/n/b.jpg">
      <img class="ti-k simg" src="<?php echo $url; ?>/img/n/ti.png">
      <div class="ti-top">
        <img class="ti-logo simg" src="<?php echo $url; ?>/img/n/top.png">
		<img class="ti-ja simg" src="<?php echo $url; ?>/img/n/j1.png">
		<div class="ti-jb simg" ></div>
  		<div class="ti-time"><?php
  		$fen=$m;
  		if ($m < 0){$m=0;}
  		if ($m < 10){
  		    $fen='0'.$m;
  		}
  		if ($s < 0){$s=0;}
  		$miao=$s;
  		if ($s < 10){
  		    $miao='0'.$s;
  		}
  		echo $fen,':',$miao; ?></div>
  		<div class="ti-title">第一题 （1/<?php echo $aTiShu ?>）</div>
	  </div>
  	  <div class="ti-wen"><p><?php echo $tiA[0]['title']; ?></p></div>
	  <div class="ti-tma">
			<img class="ti-xa ti-x simg" src="<?php echo $url; ?>/img/ti-xa.png">
	        <div class="ti-dan ti-dana"><?php echo $tiA[0]['da']; ?></div>
	  </div>
	  <div class="ti-tma">
			<img class="ti-xb ti-x simg" src="<?php echo $url; ?>/img/ti-xb.png">
	        <div class="ti-dan ti-danb"><?php echo $tiA[0]['db']; ?></div>
	  </div>
	  <div class="ti-tma">
			<img class="ti-xc ti-x simg" src="<?php echo $url; ?>/img/ti-xc.png">
	        <div class="ti-dan ti-danc"><?php echo $tiA[0]['dc']; ?></div>
	  </div>
	  <div class="ti-tma ti-sd">
			<img class="ti-xd ti-x simg" src="<?php echo $url; ?>/img/ti-xd.png">
	        <div class="ti-dan ti-dand"><?php echo $tiA[0]['dd']; ?></div>
	  </div>
	  <div class="ti-gapa"></div>
  	  <div class="ti-xuanze">
		<img class="ti-ua ti-u simg" data-id="a" src="<?php echo $url; ?>/img/ti-a.png">
  		<img class="ti-ub ti-u simg" data-id="b" src="<?php echo $url; ?>/img/ti-b.png">
  		<img class="ti-uc ti-u simg" data-id="c" src="<?php echo $url; ?>/img/ti-c.png">
  		<img class="ti-ud ti-u simg" data-id="d" src="<?php echo $url; ?>/img/ti-d.png">
	  </div>
  	  <div class="ti-gapb"></div>
  	  <div class="ti-sj">
		<img class="ti-pre simg" src="<?php echo $url; ?>/img/ti-pre.png">
  		<img class="ti-next simg" src="<?php echo $url; ?>/img/ti-next.png">
	  
	  </div>	
  		
  		
  </div>
  
  <div class="t-bg"></div>
  <div class="t-bg2"></div>
  <div class="t-end">
	<div class="t-doend">
	   <div class="t-endtxt"></div>
	
	</div>
	<div class="t-close simg"></div>
  </div>
  <div class="t-time">
	<img class="t-tiend simg" src="<?php echo $url; ?>/img/time.png">
	<div class="time-close simg"></div>
  </div>
  <div class="t-wan">
	<img class="t-wanbg simg" src="<?php echo $url; ?>/img/end.png">
	<div class="t-wclose simg"></div>
  </div>
  <div class="js_dialog" id="iosDialog2" style="opacity: 1;">
       <div class="weui-mask"></div>
       <div class="weui-dialog">
                <div class="weui-dialog__bd weui-msg"></div>
                <div class="weui-dialog__ft">
                    <a href="javascript:;" class="weui-dialog__btn weui-dialog__btn_primary weui-btn">知道了</a>
                </div>
        </div>
 </div>
</div>
<script src="http://apps.bdimg.com/libs/jquery/2.1.4/jquery.min.js"></script>
<script src="<?php echo $url; ?>/js/pxloader-images.min.js"></script>
<script src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
h= Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
var sWidth = parseInt((window.innerWidth > 0) ? window.innerWidth : screen.width);
if(sWidth>640){sWidth=640;}
var _rate=(sWidth/640);
if(h<_rate*1028){
	//h=_rate*1028;
}
var _fen=<?php echo $m+1; ?>;
var _s=<?php echo $s; ?>;
var _shijian=0;
var _twidth=_rate*517;
function countTime(){
	var date = new Date();  
	var now = date.getTime();
	var leftTime = end-now; 
	console.log(leftTime);
	var m,s; 
	if (leftTime >= 0){
		m = Math.floor(leftTime/1000/60%60);
		s = Math.floor(leftTime/1000%60);
		var _tmpS=':'+s;
		if(s<10){
			_tmpS=':0'+s;
		}
		$(".ti-time").html(m + _tmpS );
		setTimeout(countTime,1000); 
	}else{
	   if(false == _hasEnd){
		  $(".t-time, .t-bg2").show();
       }
	  console.log('end');
	}
}
var _fdes='<?php echo $openid; ?>';
var _img=['ti.png'];
var loader = new PxLoader();
for(var i=0; i<_img.length; i++){loader.addImage('<?php echo $url; ?>/img/n/'+_img[i]);}
loader.start();
var endDate = new Date(); 
end = endDate.getTime(); 
loader.addCompletionListener(function(e) {
     $(".ti").show();
     var time = 400;
     window.setTimeout(function(){
    	 endDate = new Date(); 
         var min=endDate.getMinutes();
         endDate.setMinutes(min+10);
         end = endDate.getTime();
         var _getCookieTime=getCookie('xT32');
         console.log('a1:'+_getCookieTime);
         if(_getCookieTime != '' && 0 != _getCookieTime){
            end = _getCookieTime;
         }
         console.log('a1:'+end);
         <?php if($logNum > 0){ ?>
         end =0;
         $(".ti-time").html('00:00');
         <?php }else{ ?>
         $(".ti-time").html('10:00');
         <?php } ?>
         setCookie("xT32", end, 1);
    	 countTime();
         }, 1400);
});
function setCookie(cname, cvalue, exdays) {
    var d = new Date();
    d.setTime(d.getTime() + (exdays*24*60*60*2));
    var expires = "expires="+ d.toUTCString();
    document.cookie = cname + "=" + cvalue + ";" + expires + ";path=/";
}
function getCookie(cname) {
    var name = cname + "=";
    var decodedCookie = decodeURIComponent(document.cookie);
    var ca = decodedCookie.split(';');
    for(var i = 0; i <ca.length; i++) {
        var c = ca[i];
        while (c.charAt(0) == ' ') {
            c = c.substring(1);
         }
         if (c.indexOf(name) == 0) {
            return c.substring(name.length, c.length);
         }
     }
    return "";
}
function chinanum(num){  
    var china = new Array('零','一','二','三','四','五','六','七','八','九');  
    var arr = new Array();
    var num=num+'';
    var english = num.split("")  
    for(var i=0;i<english.length;i++){
        arr[i] = china[english[i]];
    }
    if(2 == english.length){
        if('一' == arr[0]){
        	return ('十'+arr[1]);
        }else{
        	return (arr[0]+'十'+arr[1]);
        }
    }else{
    	return arr.join("")  
    }
}
var _userdt=[];
for(i=0;i<152;i++){
	_userdt[i]='';
}
var _tiA=<?php echo json_encode($tiA); ?>;
var _tidan=<?php echo json_encode($tidan); ?>;
var _tiIndex=0;
var _userFen=0;
var _hasEnd=false;
var _aTiShu=<?php echo $aTiShu ?>;
var _abTiShu=_aTiShu;
$(function(){
	$('.container').width(sWidth).height(h);
	$('.page, .zhuyi-t1').width(sWidth).height(_rate*1028);
	$('.ti-k').width(sWidth).height(_rate*1068).css({"top":_rate*6});
	$('.ti-logo').width(_rate*164).height(_rate*182).css({"top":0, right:0});
	$(".ti-ja").width(_rate*517).height(_rate*40).css({"top":_rate*65, "left":_rate*56});
	$(".ti-jb").width(0).height(_rate*40).css({"top":_rate*65, "left":_rate*56});
	$(".ti-time").css({"top":_rate*46});
	$(".ti-title").css({"top":_rate*126});
	$(".ti-x").width(_rate*46).height(_rate*46).css({"top":_rate*0, "left":0});
	$(".ti-dan").css({"margin-left":_rate*60});
	$(".t-timeout").width(_rate*490).height(_rate*457).css({"top":_rate*200, "left":_rate*75});

    _cha=h-_rate*882;
    _top=0;
    if(_cha > 0){
       var _top=_cha/2;
    }
	$(".t-doend, .t-wanbg").width(sWidth).height(_rate*877).css({"top":_top, "left":0});
	$(".t-tiend").width(sWidth).height(_rate*544).css({"top":_rate*140, "left":0});
	$(".t-wclose, .t-timeclose").width(_rate*270).height(_rate*80).css({"top":_rate*494, "left":_rate*185});
	$(".t-close, .time-close").width(_rate*320).height(_rate*100).css({"top":_rate*490, "left":_rate*166});
	$('.p1-bm').width(_rate*290).height(_rate*80).css({"top":_rate*716, "left":_rate*174});
	$('.rule-qd').width(_rate*380).height(_rate*74).css({"top":_rate*876, "left":_rate*130});
	$(".ti-gapa").height(_rate*40);
	$(".ti-xuanze").height(_rate*100);
	$(".ti-gapb").height(_rate*50);
	$(".ti-u").width(_rate*116).height(_rate*98);
	$(".ti-ua").css({"top":_rate*0, "left":_rate*70});
	$(".ti-ub").css({"top":_rate*0, "left":_rate*200});
	$(".ti-uc").css({"top":_rate*0, "left":_rate*328});
	$(".ti-ud").css({"top":_rate*0, "left":_rate*454});
	$('.ti-pre, .ti-next').width(_rate*243).height(_rate*80);
	$('.ti-pre').css({"top":0, "left":_rate*70});
	$('.ti-next').css({"top":0, "left":_rate*326});
	$(".ti-top").height(_rate*170);
	$(".t-endtxt").css({"top":_rate*180});
	 

	$(".t-tclose").width(_rate*270).height(_rate*80).css({"top":_rate*484, "left":_rate*185});
	$(".tip-t1").css({"top":_rate*300});
	$(".tip-t2").css({"top":_rate*390});
	$(".tip-t3").css({"top":_rate*450});

	var _logTimeId=1;
	if(1 == _logTimeId){ //记录用户答题次数
		$.post("api/?c=logtime", {fdes:_fdes}, function(data){}, "json"); 
		_logTimeId=2;
	}
 
 
   var _tiClick=true;	
   $(".ti-u").click(function(){
       var _id=$(this).attr("data-id");
       $(".ti-u").each(function(){
	      var _tmpid=$(this).attr("data-id");
		  $(this).attr("src", "<?php echo $url; ?>/img/ti-"+_tmpid+".png");
	   });
       _userdt[_tiIndex]=_id;
	   $(".ti-u"+_id).attr("src", "<?php echo $url; ?>/img/ti-"+_id+"2.png");

	   if(true == _tiClick){
		   $(".ti-pre").attr("src","<?php echo $url; ?>/img/ti-pre.png");
		   $(".ti-next").attr("src","<?php echo $url; ?>/img/ti-next.png");
	   }
   });

    $(".ti-pre").click(function(){
        if(_tiIndex < 1){return;}
        _tiIndex--;
        var _zwen=chinanum(_tiIndex+1);  
		$(".ti-title").html("第"+_zwen+"题（"+(_tiIndex+1)+"/"+_abTiShu+"）");
	 
            var _tmpIndex=_tiIndex;
        	$(".ti-wen p").html(_tiA[_tmpIndex].title);
        	$(".ti-dana").html(_tiA[_tmpIndex].da);
    		$(".ti-danb").html(_tiA[_tmpIndex].db);
    		$(".ti-danc").html(_tiA[_tmpIndex].dc);
    		if('' == _tiA[_tmpIndex].dd){
    			$(".ti-sd, .ti-ud").hide(); 
        	}else{
        		$(".ti-sd, .ti-ud").show();
        		$(".ti-dand").html(_tiA[_tmpIndex].dd);
            }
         

        if(_userdt[_tiIndex] != ''){
        	$(".ti-u").each(function(){
      	      var _tmpid=$(this).attr("data-id");
      		  $(this).attr("src", "<?php echo $url; ?>/img/ti-"+_tmpid+".png");
      	   });
      	   $(".ti-u"+_userdt[_tiIndex]).attr("src", "<?php echo $url; ?>/img/ti-"+_userdt[_tiIndex]+"2.png");
        }else{
        	$(".ti-u").each(function(){
        	      var _tmpid=$(this).attr("data-id");
        		  $(this).attr("src", "<?php echo $url; ?>/img/ti-"+_tmpid+".png");
        	   });
        }
        _tiClick=true;
		$(".ti-next").attr("src","<?php echo $url; ?>/img/ti-next.png");
        $(".ti-pre").attr("src","<?php echo $url; ?>/img/ti-pre2.png");
	});
	var _sendId=1;
	$(".ti-next").click(function(){
		console.log(_userdt);
		var _tmpCount=_abTiShu-2;
		if(_tiIndex > _tmpCount){
			 _hasEnd=true;
			 _tiClick=false;
			 $(".t-timeout").hide();
	          $(".t-bg2, .t-end, .t-tiend").fadeIn();
	          var _rightNum=0;
		   	  $(_userdt).each(function(key,data){
		   		    if(data == _tidan[key]){
		   		    	_rightNum++;
		   			}
		   	  });
		      var _dt=JSON.stringify(_userdt);
		      $.post("api/?c=cishu", {fdes:_fdes,dt:_dt, tiku:'<?php echo json_encode($tiku); ?>'}, function(data){

			      }, "json"); 
		   	  //$(".t-endtxt").html("您共答对"+_rightNum+'道题');
			return;
		}
		_tiIndex++;
		_sendId++;
		if(_sendId > 3){
		   _sendId=0;
		   var _dt=JSON.stringify(_userdt);
		   $.post("api/?c=logci", {nianji:'<?php echo $nianji; ?>',di:_tiIndex,fdes:_fdes,dt:_dt, tiku:'<?php echo json_encode($tiku); ?>'}, function(data){
		   }, "json");
	    }
		var _zwen=chinanum(_tiIndex+1);  
		$(".ti-title").html("第"+_zwen+"题（"+(_tiIndex+1)+"/"+_abTiShu+"）");
            var _tmpIndex=_tiIndex;
        	$(".ti-wen p").html(_tiA[_tmpIndex].title);
        	$(".ti-dana").html(_tiA[_tmpIndex].da);
    		$(".ti-danb").html(_tiA[_tmpIndex].db);
    		$(".ti-danc").html(_tiA[_tmpIndex].dc);

    		if('' == _tiA[_tmpIndex].dd){
    			$(".ti-sd, .ti-ud").hide(); 
        	}else{
        		$(".ti-sd, .ti-ud").show();
        		$(".ti-dand").html(_tiA[_tmpIndex].dd);
            }
        if(_userdt[_tiIndex] != ''){
        	$(".ti-u").each(function(){
      	      var _tmpid=$(this).attr("data-id");
      		  $(this).attr("src", "<?php echo $url; ?>/img/ti-"+_tmpid+".png");
      	   });
      	   $(".ti-u"+_userdt[_tiIndex]).attr("src", "<?php echo $url; ?>/img/ti-"+_userdt[_tiIndex]+"2.png");
        }else{
        	$(".ti-u").each(function(){
        	      var _tmpid=$(this).attr("data-id");
        		  $(this).attr("src", "<?php echo $url; ?>/img/ti-"+_tmpid+".png");
        	   });
        }
         
		$(".ti-pre").attr("src","<?php echo $url; ?>/img/ti-pre.png");
		if((_abTiShu-1) == _tiIndex){
			_tiClick=false;
			$(".ti-next").attr("src","<?php echo $url; ?>/img/ti-jiao.png");
		}else{
			_tiClick=true;
			$(".ti-next").attr("src","<?php echo $url; ?>/img/ti-next2.png");
		}
        
	});

   $(".t-close").click(function(){
		   _hasEnd=true;
		   _tiClick=false;
	       $(".t-bg2, .t-end").fadeIn();
	       var _rightNum=0;
		   $(_userdt).each(function(key,data){
	   		    if(data == _tidan[key]){
	   		    	_rightNum++;
	   			}
		   	});
		    var _dt=JSON.stringify(_userdt);
		    $.post("api/?c=cishu", {fdes:_fdes,dt:_dt, tiku:'<?php echo json_encode($tiku); ?>'}, function(data){
		    	  $(".weui-msg").html("即将关闭本页");
		          $("#iosDialog2").show();
		          window.setTimeout(function(){
		        	  window.location.href="game.php";
			          }, 1800); 
			 }, "json"); 
		   //	$(".t-endtxt").html('您共答对'+_rightNum+'道题');
	});

   $(".time-close").click(function(){
	   $(".t-time").hide();
	   $(".t-bg2, .t-end").fadeIn();
       var _rightNum=0;
	   $(_userdt).each(function(key,data){
   		    if(data == _tidan[key]){
   		    	_rightNum++;
   			}
	   	});
	    var _dt=JSON.stringify(_userdt);
	    $.post("api/?c=cishu", {fdes:_fdes,dt:_dt, tiku:'<?php echo json_encode($tiku); ?>'}, function(data){
		 }, "json"); 
	   	//$(".t-endtxt").html('您共答对'+_rightNum+'道题');
   
   });

    
   $.post("api/?c=getlogci", {fdes:_fdes,nianji:'<?php echo $nianji; ?>',}, function(data){
       if(data.s == 'ok'){
           _tiIndex=parseInt(data.d)-1;
           _userdt=JSON.parse(data.t);
           var _zwen=chinanum(_tiIndex);  
   		$(".ti-title").html("第"+_zwen+"题（"+(_tiIndex+1)+"/"+_abTiShu+"）");
               var _tmpIndex=_tiIndex;
           	$(".ti-wen p").html(_tiA[_tmpIndex].title);
           	$(".ti-dana").html(_tiA[_tmpIndex].da);
       		$(".ti-danb").html(_tiA[_tmpIndex].db);
       		$(".ti-danc").html(_tiA[_tmpIndex].dc);
       		if('' == _tiA[_tmpIndex].dd){
       			$(".ti-sd, .ti-ud").hide(); 
           	}else{
           		$(".ti-sd, .ti-ud").show();
           		$(".ti-dand").html(_tiA[_tmpIndex].dd);
               }
            
   		$(".ti-pre").attr("src","<?php echo $url; ?>/img/ti-pre.png");
   		if((_abTiShu-1) == _tiIndex){
   			_tiClick=false;
   			$(".ti-next").attr("src","<?php echo $url; ?>/img/ti-jiao.png");
   		}else{
   			_tiClick=true;
   			$(".ti-next").attr("src","<?php echo $url; ?>/img/ti-next.png");
   		}
       	 
       }
       console.log(data);
   }, "json"); 
   
   
	$(".weui-btn").click(function(){
        $("#iosDialog2").hide();
	});
 
	if(!('placeholder' in document.createElement('input')) ){   
	    $('input[placeholder],textarea[placeholder]').each(function(){var that = $(this),text= that.attr('placeholder');   
	      if(that.val()===""){that.val(text).addClass('placeholder');}   
	      that.focus(function(){if(that.val()===text){that.val("").removeClass('placeholder');}})   
	      .blur(function(){if(that.val()===""){that.val(text).addClass('placeholder');}})   
	      .closest('form').submit(function(){   
	        if(that.val() === text){that.val('');}});});   
	 }
 
});
</script>
</body>
</html>